﻿namespace Bootsy.Core

import Bootsy.PEG

class GrammarBasedBot(IChatParticipant):
	
	_grammar as IGrammarRule
	
	def constructor([required] rule as IGrammarRule):
		_grammar = rule
		
	def OnMessage(message as IChatMessage):
		action = StringParser(message.Body, message).Evaluate(_grammar)
		action() if action is not null
		
